<template>
	<div id="app">
		<router-view />
	</div>
</template>

<script>
	export default {
		name: 'App',
		data() {
			return {

			}
		},
		mounted() {
			this.gainMessage();
		},
		methods: {
			gainMessage() {
				let datas = {
					instanceId: this.getQueryString('instanceId'),
					timestamp: this.getQueryString('timestamp'),
					sign: this.getQueryString('sign'),
					number: this.getQueryString('number'),
					userType: this.getQueryString('userType')
				}
				let flag = true;
				for (let i in datas) {
					if (!datas[i] || datas[i] == "" || datas[i] == undefined) {
						flag = false;
					}
				}
				if (flag) {
					//查看是否合法
// 					this.$ajax.post(this, this.$api.GET_RETURN_PARAMS, datas,
// 						(res) => {});
					//判断小额还是进件
					let formdatas = {};
					formdatas.instanceId = datas.instanceId;
					formdatas.number = datas.number;
					this.$ajax.post(this, this.$api.GET_STATUS_GET, formdatas,
						(res) => {
							if (res.code == '200') {
								if (!res.data.content.code) {
									this.$router.push({
										name: "Error",
										query: {
											statusMsg: res.data.content.statusMsg,
											isSuccess: 'true',
											formdatas: JSON.stringify(formdatas),
											verifyNum: res.data.content.verifyNum,
											restartNum: res.data.content.verifyNum,
											statusCode: res.data.content.statusCode,
											userType:this.getQueryString('userType')
										}
									})
									// 									this.$router.push({
									// 										name: "SmallAuthentication",
									// 										query: {
									// 											instanceId: datas.instanceId,
									// 											number: datas.number,
									// 											verifyNum: res.data.content.verifyNum,
									// 											restartNum: res.data.content.restartNum
									// 										}
									// 									})
								} else {
									this.$router.push({
										name: "EnterpriseCertification",
										query: {
											instanceId: datas.instanceId,
											number: datas.number,
											userType:datas.userType
										}
									})
								}
							} else {
								this.$router.push({
									name: "Error"
								})
							}

						}, (err) => {
							console.log(error, "33333");
						});
				} else {
					this.$router.push({
						name: "Error"
					})
				}

			},
			getQueryString(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
				var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
				var r = window.location.search.substr(1).match(reg);
				var q = window.location.pathname.substr(1).match(reg_rewrite);
				if (r != null) {
					return unescape(r[2]);
				} else if (q != null) {
					return unescape(q[2]);
				} else {
					return null;
				}
			}
		}
	}
</script>

<style>
	#app {
		font-family: 'Avenir', Helvetica, Arial, sans-serif;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		color: #2c3e50;
		background: #f7f8fa;
		height: 100%;
	}

	.mint-cell-value input {
		text-align: right;
	}

	.mint-cell-value.is-link {
		color: #777;
	}

	.activeSelect {
		color: black;
	}

	#app .mint-switch-input:checked+.mint-switch-core {
		border-color: red;
		background-color: red;
	}
	.mint-cell:not(:last-child)  .mint-cell-value .mint-cell {
		background-image: none !important;
	}
	.mint-msgbox {
		max-height: 80% !important;
		overflow: scroll !important;
	}
	.ivu-checkbox-checked:hover .ivu-checkbox-inner,
	.ivu-checkbox-checked .ivu-checkbox-inner {
		border-color: red !important;
		background-color: red !important;
	}
</style>
